-module(install).
-compile(export_all).

-include_lib("stdlib/include/qlc.hrl"). 
-include("../db_structure.hrl").

  
installuser() ->
    mnesia:create_schema([node()]),
    mnesia:start(),
    mnesia:create_table(user,
        [ {disc_copies, [node()] },
          {type, set},
          {attributes,  record_info(fields,user)} ]),

    mnesia:create_table(subscription,
        [
         {disc_copies, [node()]},
         {attributes, record_info(fields, subscription)},
         {index, [channel]},
         {type, bag}
        ]).

index('GET', Req) ->
    installuser(),
    template:render_html(Req, "install", []).
